//
//  CZQMyInfoHeadView.m
//  coachmanage
//
//  Created by 众拳科技 on 2018/3/13.
//  Copyright © 2018年 众拳科技. All rights reserved.
//

#import "CZQMyInfoHeadView.h"

@implementation CZQMyInfoHeadView

-(instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier{
    
    if (self=[super initWithReuseIdentifier:reuseIdentifier]) {
        
        //bg
        UIView *bgView = [UIView new];
        
        bgView.backgroundColor = [UIColor whiteColor];
        
        [self addSubview:bgView];
        
        self.yView = bgView;
        
        //竖线
        UIView *suView = [UIView new];
        
        suView.backgroundColor = CSColorFromRGB(0xffdd00);
        
        [self.yView addSubview:suView];
        
        self.suView = suView;
        
        //标题
        UILabel *titleLable = [UILabel new];
        
        titleLable.text = @"主题";
        
        titleLable.font = [UIFont systemFontOfSize:15];
        
        [self.yView addSubview:titleLable];
        
        self.titileLable = titleLable;
        
        UIButton *eidtBtn = [UIButton new];
        
        [eidtBtn setImage:@"icon_edit"];
        
        [eidtBtn setTitle:@"编辑"];
        
        [eidtBtn setTitleColor:CSBlackColor1];
        
        
        
        eidtBtn.titleLabel.font = [UIFont systemFontOfSize:15];
        
        [self.yView addSubview:eidtBtn];
        
        self.eidtBtn = eidtBtn;
        
        
        [self setConstraints];
        
        
    }
    
    
    
    return self;
}


-(void)setConstraints
{
    //bgView
    [self.yView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(self).offset(10);
        
        make.left.right.bottom.mas_equalTo(self);
        
    }];
    
    //竖线
    [self.suView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerY.mas_equalTo(self.yView);
        
        make.left.mas_equalTo(self.yView).offset(30);
        
        make.height.mas_equalTo(20);
        
        make.width.mas_equalTo(2);
        
    }];
    
    //主题
    [self.titileLable mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerY.mas_equalTo(self.yView);
        
        make.left.mas_equalTo(self.suView.mas_right).offset(10);
        
    }];
    
    //编辑按
    [self.eidtBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.right.mas_equalTo(self.yView).offset(-20);
        make.centerY.mas_equalTo(self.yView);
        
    }];
    
    [self.eidtBtn imageOnTheTitleLeftWithSpace:5];
    
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
